'''This is a testing program to make sure that the low pass filter method used in the script LFPdata.py is working correctly. I will make several sine waves of known frequencies add a static noise and filter to see if I get back what I expect'''
import numpy, scipy, pylab, random, math 

xs = numpy.arange(0,1,.001)
signal10 = numpy.sin(xs*2*math.pi*10) #This is a 10 Hz signal
signal20 = numpy.sin(xs*2*math.pi*20) #This is a 10 Hz signal
signal30 = numpy.sin(xs*2*math.pi*30) #This is a 10 Hz signal

signal = signal10 + signal20 + signal30
static = (numpy.random.random_sample((len(xs))))
noisysignal = signal + static
pylab.subplot(211)
pylab.plot(xs,noisysignal)

fft = scipy.fft(noisysignal)
bp = fft[:]
for i in range(len(bp)):
    if i>10: bp[i]=0
ibp = scipy.ifft(bp)
pylab.subplot(212)
pylab.plot(xs, ibp)
